package com.bop.dehong.center.adapter;

import com.bop.dehong.R;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

@SuppressLint("InflateParams")
public class MoreAdapter extends BaseAdapter {
	private int[] icon;
	private int[] title;
	private Context context;

	public MoreAdapter(Context context, int[] icon, int[] title) {
		this.context = context;
		this.icon=icon;
		this.title=title;
	}

	@Override
	public int getCount() {
		return icon != null ? icon.length : 0;
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(R.layout.more_list_items, null);
			holder.icon = (ImageView) convertView
					.findViewById(R.id.more_list_items_icon);
			holder.title = (TextView) convertView
					.findViewById(R.id.more_list_items_title);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.icon.setImageResource(icon[position]);
		holder.title.setText(title[position]);
		return convertView;
	}

	private class ViewHolder {
		private ImageView icon;
		private TextView title;
	}

}
